<template>
    <div class="wrapper">
        <div class="item" v-for="item in list" :key="item.businessCode">
            <div class="content">
                <div class="left">
                    <div class="top">{{ item.accountName }}</div>
                    <div class="bottom">{{ item.aviBal }}</div>
                </div>
                <div class="right" @click="goTxPage(item)">
                    提现
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { defineComponent } from 'vue'
import { accountList } from '@/api/wallet'
import store from "../../store"

export default defineComponent({
    name: 'walletList',
    setup() {
        const router = useRouter()
        const state = reactive({
            list: []
        })
        const aaaaa = () => {
            console.log(1)
        }
        const getAccountList = () => {
            accountList().then(res => {
                state.list = res.object
            })
        }
        const goEdit =()=>{
            router.push({
                path:'/accountDetail'
            })
        }
        getAccountList()
        const goTxPage = item => {
            router.push({
                path: '/cashInfo',
                query: {
                    businessCode: item.businessCode,
                    balance: item.balance,
                    accountType: item.accountType,
                    token:store.state.user.token
                }
            })
        }
        return {
            ...toRefs(state),
            goTxPage,
            goEdit,
        }
    }
})
</script>

<style scoped lang="scss">
.wrapper {
    padding: 0 10px;
    .item {
        position: relative;
        margin-top: 20px;
        height: 84px;
        width: 100%;
        // background: linear-gradient(90deg, #F28989 0%, #D44848 100%);
        background: url(@/assets/index/carditem2.png) no-repeat top left / 100% 100%;
        // background-size: cover;
        .bg {
            width: 100%;
        }
        .content {
            box-sizing: border-box;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-left: 30px;
            .left {
                line-height: 30px;
                .top {
                    font-size: 14px;
                    font-weight: 400;
                    color: #363636;
                }
                .bottom {
                    font-size: 18px;
                    font-weight: bold;
                    color: #363636;
                    // opacity: 1;
                }
            }
            .right {

                width: 100px;
                height: 70px;
                // background: url(@/assets/index/button.png) no-repeat top left / 100% 100%;
                line-height: 70px;
                text-align: end;
                margin-right: 30px;
                color: #fff;
                // background: #f7f8fa;
                // opacity: 1;
                // border-radius: 15px 0px 0px 15px;
                // font-size: 14px;
                // font-weight: 400;
                // color: #D44848;
                // display: flex;
                // align-items: center;
                // justify-content: center;
                // div {
                //     margin-left: 10px;
                //     width: 10px;
                //     height: 10px;
                //     background: #D44848;
                //     border-radius: 50%;
                //     opacity: 1;
                // }
            }
        }
    }
}
.btn{
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
}
</style>
